<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<% content_for :stylesheets do %>
<style>
#content {
  padding: 0;
}
#content_preview {
  width: 100%;
  height: 300px;
  border: 0;
}
#file_content {
  width: 100%;
}
#file_content td {
  padding: 0;
  vertical-align: top;
}
#file_content_header {
  background: url("/images/canvas/header_bg.png") repeat-x left -28px;
  border-bottom: 1px solid #aaa;
  padding: 8px 5px 0px 45px;
  text-align: center;
  min-height: 25px;
}
#content_holder {
  width: 100%;
}
#file_content_header a {
  color: #333;
  font-weight: bold;
}
#file_content .context_module .header .completion_status {
  display: none;
}
#file_content .context_module .header  {
  margin-left: 5px;
}
#file_content .context_module {
  margin-bottom: 0;
  width: 100%;
  overflow: hidden;
}
#file_content .context_module_item td {
  padding-top: 2px;
  padding-bottom: 2px;
}
#file_content .hide_sidebar_link {
  position: absolute;
  top: 3px;
  right: 3px;
}
#file_content .modules_holder {
  background-color: #F2F3F4;
}
#modules {
  overflow: auto;
  width: 250px;
  position: relative;
  border-right: 1px solid #aaa;
}
#modules .context_module_item .move_item_link {
  display: none;
}
#modules .context_module_item .title {
  white-space: nowrap;
}
#modules .context_module_item .due_date_display,
#modules .context_module_item .points_possible_display,
#modules .context_module_item .links {
  display: none;
}
#modules .context_module_item.context_module_sub_header .title {
  white-space: inherit;
}
#modules .context_module_item .module_item_icons {
  padding-left: 20px;
}
#modules .context_module {
  border: 0
}
#modules .context_module .reorder_module_link {
  display: none;
}
#modules .context_module .links {
  display: none;
}
#modules .context_module .header {
  background: transparent;
  border: 0;
}
#modules .context_module .footer {
  display: none;
}
#modules .context_module_item .links {
  display: none;
}
#modules .context_module_item.selected .title {
  font-weight: bold;
}
#modules .context_module_item.selected .module_item_icons {
  background: url(/images/arrow_right.png) no-repeat left 3px;
}
#modules .context_module_item .title {
  white-space: normal;
}
#file_display_name {
  font-size: 1.5em;
  font-weight: bold;
}
</style>
<% end %>

<div id="file_content_header">
  <div style="float: left;" id="file_display_name"><%= @attachment ? @attachment.display_name : @tag.title %>
  </div>
  <div style="float: right; padding-top:0.5em;">
    <a href="#" id="frameless_link"><%= t 'links.exit_frame', "Lose the Frames"%></a>
  </div>
  <div id="current_item_id" style="display: none;"><%= @tag.try(:id) %></div>
  <div style="padding-top: 0.5em;">
    <a href="<%= context_url(@context, :context_url) %>"><%= t 'links.course_home', "Course Home" %></a> |
    <a href="<%= context_url(@context, :context_files_url) %>"><%= t 'links.files', "Files" %></a>
    <% if @module %>
      | <a href="<%= context_url(@context, :context_context_modules_url) %>"><%= t 'links.modules', "Modules" %></a>
    <% end %>
  </div>
  <div class="clear"></div>
</div>
<table id="file_content" cellspacing="0">
  <tr>
    <td style="<%= hidden unless @module %>" class="modules_holder">
      <div id="modules">
        {{> views/context_modules/context_module}}
        <div style="float: right; margin-top: 5px;">
          <a href="#" class="hide_sidebar_link no-hover" title="<%= t 'links.hide_sidebar', "Hide Sidebar" %>"><%= image_tag "delete_circle.png", :alt => t('Hide Sidebar') %></a>
        </div>
      </div>
    </td>
    
    <td id="content_holder">
      <% if @attachment %>
        <iframe name="content_preview" frameborder="0" id="content_preview" src="<%= context_url(@context, :context_file_url, @attachment.id) %>/<%= @attachment.full_path %>" title="{{#t}}Preview{{/t}}">
        </iframe>
      <% elsif @tag %>
        <iframe name="content_preview" frameborder="0" id="content_preview" src="<%= @tag.url %>" title="{{#t}}Preview{{/t}}">
        </iframe>
      <% end %>
    </td>
  </tr>
</table>

<% js_bundle 'legacy/inlined_preview' %>
